(function ($) {

  Drupal.adminsosyuki = Drupal.adminsosyuki || {};
  Drupal.adminsosyuki.behaviors = Drupal.adminsosyuki.behaviors || {};

  Drupal.adminsosyuki.height = function () {
    let height = 0;
    if (readCookie("navbar-fixed-top") == "true") {
      height += 45;
    }
    if (readCookie("breadcrumbs-fixed") == "true") {
      height += 40;
    }
    if (readCookie("page-header-fixed") == "true") {
      height += 40;
    }
    return height;
  };
  Drupal.behaviors.adminsosyuki = {
    attach: function (context, settings) {
      this.search(context, settings);
    },
    search(context, settings) {
      let $input = $(".sidebar-header-wrapper input.searchinput");
      console.log($input);
      let needle = $input.val();

      function keyupHandler() {
        let matches, $html, value = $(this).val();
        if (value !== needle) {
          needle = value;
        }
        console.log(value);
      }

      $input.bind("keyup search", keyupHandler);
    },
  };
})(jQuery);
